<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Backend</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html"><span class="hs-identifier">System.Console.Haskeline.Term</span></a></span><span>
</span><span id="line-4"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html"><span class="hs-identifier">System.Console.Haskeline.Monads</span></a></span><span>
</span><span id="line-5"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-6"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier">stdin</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.html#hGetEcho"><span class="hs-identifier">hGetEcho</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier">Handle</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#ifdef MINGW
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Backend.Win32.html"><span class="hs-identifier">System.Console.Haskeline.Backend.Win32</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Win32</span></span><span class="hs-cpp">
#else
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Backend.Posix</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Posix</span><span class="hs-cpp">
#ifdef TERMINFO
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Backend.Terminfo</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Terminfo</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Backend.DumbTerm</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">DumbTerm</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span class="annot"><a href="System.Console.Haskeline.Backend.html#defaultRunTerm"><span class="hs-identifier hs-type">defaultRunTerm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html#RunTerm"><span class="hs-identifier hs-type">RunTerm</span></a></span><span>
</span><span id="line-20"></span><span id="defaultRunTerm"><span class="annot"><span class="annottext">defaultRunTerm :: IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#defaultRunTerm"><span class="hs-identifier hs-var hs-var">defaultRunTerm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO Bool -&gt; MaybeT IO Bool
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; IO Bool
</span><a href="../../base/src/GHC.IO.Handle.html#hGetEcho"><span class="hs-identifier hs-var">hGetEcho</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier hs-var">stdin</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MaybeT IO Bool -&gt; (Bool -&gt; MaybeT IO ()) -&gt; MaybeT IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; MaybeT IO ()
forall (f :: * -&gt; *). Alternative f =&gt; Bool -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#guard"><span class="hs-identifier hs-var">guard</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeT IO () -&gt; MaybeT IO RunTerm -&gt; MaybeT IO RunTerm
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#stdinTTY"><span class="hs-identifier hs-var">stdinTTY</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-21"></span><span>                    </span><span class="annot"><span class="annottext">MaybeT IO RunTerm -&gt; IO RunTerm -&gt; IO RunTerm
forall (m :: * -&gt; *) a. Monad m =&gt; MaybeT m a -&gt; m a -&gt; m a
</span><a href="System.Console.Haskeline.Monads.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#fileHandleRunTerm"><span class="hs-identifier hs-var">fileHandleRunTerm</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier hs-var">stdin</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="annot"><a href="System.Console.Haskeline.Backend.html#terminalRunTerm"><span class="hs-identifier hs-type">terminalRunTerm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html#RunTerm"><span class="hs-identifier hs-type">RunTerm</span></a></span><span>
</span><span id="line-24"></span><span id="terminalRunTerm"><span class="annot"><span class="annottext">terminalRunTerm :: IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#terminalRunTerm"><span class="hs-identifier hs-var hs-var">terminalRunTerm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#directTTY"><span class="hs-identifier hs-var">directTTY</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeT IO RunTerm -&gt; IO RunTerm -&gt; IO RunTerm
forall (m :: * -&gt; *) a. Monad m =&gt; MaybeT m a -&gt; m a -&gt; m a
</span><a href="System.Console.Haskeline.Monads.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#fileHandleRunTerm"><span class="hs-identifier hs-var">fileHandleRunTerm</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#stdin"><span class="hs-identifier hs-var">stdin</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="annot"><a href="System.Console.Haskeline.Backend.html#stdinTTY"><span class="hs-identifier hs-type">stdinTTY</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Maybe.html#MaybeT"><span class="hs-identifier hs-type">MaybeT</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html#RunTerm"><span class="hs-identifier hs-type">RunTerm</span></a></span><span class="hs-cpp">
#ifdef MINGW
</span><span id="stdinTTY"><span class="annot"><span class="annottext">stdinTTY :: MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#stdinTTY"><span class="hs-identifier hs-var hs-var">stdinTTY</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.Win32.html#win32TermStdin"><span class="hs-identifier hs-var">win32TermStdin</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">stdinTTY</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">stdinTTYHandles</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-identifier">runDraw</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-33"></span><span class="annot"><a href="System.Console.Haskeline.Backend.html#directTTY"><span class="hs-identifier hs-type">directTTY</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Maybe.html#MaybeT"><span class="hs-identifier hs-type">MaybeT</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html#RunTerm"><span class="hs-identifier hs-type">RunTerm</span></a></span><span class="hs-cpp">
#ifdef MINGW
</span><span id="directTTY"><span class="annot"><span class="annottext">directTTY :: MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#directTTY"><span class="hs-identifier hs-var hs-var">directTTY</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeT IO RunTerm
</span><a href="System.Console.Haskeline.Backend.Win32.html#win32Term"><span class="hs-identifier hs-var">win32Term</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">directTTY</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ttyHandles</span><span> </span><span class="hs-operator">&gt;&gt;=</span><span> </span><span class="hs-identifier">runDraw</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">

#ifndef MINGW
</span><span class="hs-identifier">runDraw</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Handles</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MaybeT</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">RunTerm</span><span class="hs-cpp">
#ifndef TERMINFO
</span><span class="hs-identifier">runDraw</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">runDumbTerm</span><span class="hs-cpp">
#else
</span><span class="hs-identifier">runDraw</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">runTerminfoDraw</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">mplus</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">runDumbTerm</span><span> </span><span class="hs-identifier">h</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#endif
</span><span>
</span><span id="line-50"></span><span class="annot"><a href="System.Console.Haskeline.Backend.html#fileHandleRunTerm"><span class="hs-identifier hs-type">fileHandleRunTerm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="System.Console.Haskeline.Term.html#RunTerm"><span class="hs-identifier hs-type">RunTerm</span></a></span><span class="hs-cpp">
#ifdef MINGW
</span><span id="fileHandleRunTerm"><span class="annot"><span class="annottext">fileHandleRunTerm :: Handle -&gt; IO RunTerm
</span><a href="System.Console.Haskeline.Backend.html#fileHandleRunTerm"><span class="hs-identifier hs-var hs-var">fileHandleRunTerm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO RunTerm
</span><a href="System.Console.Haskeline.Backend.Win32.html#fileRunTerm"><span class="hs-identifier hs-var">Win32.fileRunTerm</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">fileHandleRunTerm</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Posix.fileRunTerm</span><span class="hs-cpp">
#endif
</span></pre></body></html>